<template>
  <div class="login">

    <p>
        <!-- <router-link replace to="/login/user">用户名登录</router-link> | 
        <router-link replace to="/login/phone">手机号登录</router-link> -->

        <router-link replace :to="{path:'/login/user',query:$route.query}">用户名登录</router-link> | 
        <router-link replace :to="{path:'/login/phone',query:$route.query}">手机号登录</router-link>

        <!-- <span @click="switchType('/login/user',true)">用户名登录</span> | 
        <span @click="switchType('/login/phone',true)">手机号登录</span> -->
    </p>

    <!-- 二级视图 -->
    <router-view></router-view>    
   
  </div>
</template>

<script>
    // import {getCurrentInstance}  from "vue";

    export default {
        name:"LoginView",
        methods:{
            switchType(url,isReplace=false){
                let query = this.$route.query;
                console.log("切换",url,isReplace);
                if(isReplace){
                    this.$router.replace({path:url,query:query})
                }else{
                    this.$router.push({path:url,query:query})
                }
            }
        }
    }

</script>

<style>
    .router-link-active{
        background-color: red;
        color:#fff;
    }
</style>
